function LoadAttacks(heroCon) {
  var boss = new Boss({
    fightAttri: bossConfig[1]
  })

  //var heroCon = heroConfig[100001]
  var skills = {}
  for (var i of heroCon.skills) {
    skills[i] = {
      lvl: 0
    }
  }
  var s = [440001, 440002, 440003, 440004, 440005, 440006, 440007]
  for (var i of s) {
    skills[i] = {
      lvl: 0
    }
  }

  var hero = new Hero({
    boss: boss,
    fightAttri: {},
    basicInfo: {
      name: heroCon.name,
      heroLvl: 1,
      attackLvl: 1,
      attackSpeedLvl: 1,
      thunderSkillId: heroCon.thunderSkillId,
      thunderSkill: {
        lvl: 0,
      },
      skills: skills
    }
  })
  hero.calcHeroAttri(boss)
  $('#main').html(template('battleTem', {
    hero: hero,
    boss: boss,
    propName: propName
  }))


  //战斗, 普通攻击
  var battleFuc = function() {
    var attacker = new HeroFightAttri(hero.fightAttri)
    var defender = boss.fightAttri
    setBossHp(boss)
    attack1(hero) //攻击前
    var damage = Math.floor(calcDamage(attacker, defender))
    attack4(hero, boss, damage)
    setTimeout(function() {
      if (boss.fightAttri.hp > 0) {
        battleFuc()
      }
    }, 1000 / hero.fightAttri.attackSpeed * 1000)
  }
  battleFuc()

  //升级
  $('.lvlup').click(function() {
    var value = $(this).attr('value')
    var config = lvlupConfig[value]
    if (config) {
      if (hero.basicInfo[value] >= config.max) {
        return
      }
      /*    var needGold = config.needGold[hero.basicInfo[value]]
          if (needGold && hero.basicInfo.gold > needGold) {
            hero.basicInfo.gold -= needGold
          } else if (!needGold) {
            hero.basicInfo.gold - 1
          } else {
            return
          }*/
      hero.basicInfo[value] += 1
    }
    hero.calcHeroAttri(boss)
    updateHeroInfo()
  })

  //炼金室升级
  $('.alchemyLvlUp').click(function() {
    var config = lvlupConfig['alchemyLvl']
    if (hero.basicInfo['alchemyLvl'] >= config.max) {
      return
    } else {
      hero.basicInfo['alchemyLvl'] += 1
    }
  })

  //炼金室产出金币
  setInterval(function() {
    var alchemyLvl = hero.basicInfo['alchemyLvl']
    if (alchemyLvl <= 0 || boss.fightAttri.hp <= 0) {
      return
    }
    var config = lvlupConfig['alchemyLvl']
    var value = config.values[alchemyLvl - 1]
    hero.basicInfo.gold += value
    hero.basicInfo.total += value
  }, 5000)

  //技能升级
  $('.skillLvlup').click(function() {
    var skillId = $(this).attr('value')
    skillId = parseInt(skillId)
    var config = skillConfig[skillId]
    if (config) {
      if (hero.basicInfo.skills[skillId].lvl >= config.max) {
        return
      }
      /*
            var needGold = config.needGold[hero.basicInfo[value][1]]
            if (needGold && hero.basicInfo.gold > needGold) {
              hero.basicInfo.gold -= needGold
            } else if (!needGold) {
              hero.basicInfo.gold - 1
            } else {
              return
            }*/
      hero.basicInfo.skills[skillId].lvl += 1
      var lvl = hero.basicInfo.skills[skillId].lvl
      if (skillId === 440012) {
        var buff = hero.basicInfo.buffs[450012]
        if (!buff) {
          hero.basicInfo.buffs[450012] = {
            cd: 0, //buffcd 0永久
            maxStack: skillConfig[440012].maxStackBuff[lvl - 1],
            stack: 0,
            timer: null, //定时器
          }
        } else {
          buff.maxStack = skillConfig[440012].maxStackBuff[lvl - 1]
        }
      }
    }
    hero.calcHeroAttri(boss)
    updateHeroInfo()
    skillEvent(hero, boss, skill, skillId)
  })

  //技能升级
  $('.thunderSkillLvlup').click(function() {
    var skillId = hero.basicInfo.thunderSkillId
    var config = skillConfig[skillId]
    if (config) {
      if (hero.basicInfo.thunderSkill.lvl >= config.max) {
        return
      }
      /*
            var needGold = config.needGold[hero.basicInfo[value][1]]
            if (needGold && hero.basicInfo.gold > needGold) {
              hero.basicInfo.gold -= needGold
            } else if (!needGold) {
              hero.basicInfo.gold - 1
            } else {
              return
            }*/
      hero.basicInfo.thunderSkill.lvl += 1
    }
    hero.calcHeroAttri(boss)
    updateHeroInfo()

    skillEvent(hero, boss, hero.basicInfo.thunderSkill, skillId)
  })

  //更新面板伤害信息
  setInterval(function() {
    while (msgLen > 20) {
      $('.damageMsg .msg:last').remove()
      msgLen -= 1
    }
  }, 1000)


  //更新角色信息
  setInterval(function() {
    updateHeroInfo()
  }, 300)

  function updateHeroInfo() {
    $('.lvlInfo .alchemyLvl').html(hero.basicInfo.alchemyLvl || 0)
    $('.lvlInfo .heroLvl').html(hero.basicInfo.heroLvl)
    $('.lvlInfo .attackLvl').html(hero.basicInfo.attackLvl)
    $('.lvlInfo .attackSpeedLvl').html(hero.basicInfo.attackSpeedLvl)
    $('.lvlInfo .critRateLvl').html(hero.basicInfo.critRateLvl)
    $('.lvlInfo .critHurtLvl').html(hero.basicInfo.critHurtLvl)
    $('.lvlInfo .punctureLvl').html(hero.basicInfo.punctureLvl)
    $('.attri .attack').html(hero.fightAttri.attack)
    $('.attri .attackSpeed').html(hero.fightAttri.attackSpeed)
    $('.attri .critRate').html(hero.fightAttri.critRate)
    $('.attri .critHurt').html(hero.fightAttri.critHurt)
    $('.attri .puncture').html(hero.fightAttri.puncture)
    $('.attri .anger').html(hero.basicInfo.anger)
    $('.attri .gold').html(hero.basicInfo.gold)
    $('.bossMsg .defend').html(boss.fightAttri.defend)
    $('.bossMsg .skillHurt').html(boss.fightAttri.skillHurt)
    $('.bossMsg .dodge').html(boss.fightAttri.dodge)
    for (var i in hero.basicInfo.skills) {
      $('.' + i + 'Lvl').html(hero.basicInfo.skills[i].lvl || 0)
    }
    $('.thunderSkillLvl').html(hero.basicInfo.thunderSkill.lvl || 0)
  }

}
